<%@ page language="java" pageEncoding="UTF-8"%>
<%
    String cooperateOrgId = request.getParameter("n");
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort() + path;
%>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;" name="viewport"> 
	<meta content="yes" name="apple-mobile-web-app-capable">
	<meta content="black" name="apple-mobile-web-app-status-bar-style">
	<meta content="telephone=no" name="format-detection">
    <title>直播</title>
	<link rel="stylesheet" href="css/base.css">
	<link rel="stylesheet" href="css/page.css">
    <link rel="stylesheet" href="css/swiper.min.css"/>	
</head>

<body bgcolor="#FFF">
    <div style="display:none"><img src="images/pic.png"/></div>
	<article class="index_box" style="padding-bottom:4rem;">
		<section class="search_box">
        	<div class="search_content">
                <dl class="default">
                    <dt><img src="images/logo.png"></dt>
                    <dd>直播间<a href="#"></a></dd>
                </dl>
                <dl class="normal" style="display:none;">
                    <dt><a href="#" onclick="searchLive()" ></a></dt>
                    <dd>
                        <div class="data"><input id="liveTitle" type="text" placeholder="请输入搜索内容" class="search_input">
                        <i onclick="$('#liveTitle').val('');$('#searchLi').hide()"></i>
                        </div>
                        <a href="#" onclick="$('#liveTitle').val('');$('#searchLi').html('');">取消</a>
                    </dd>
                </dl>
            </div>
            <ul class="result">
            	<li id="searchLi"></li>
            </ul> 
            <div class="search_mask"></div>
        </section>
        <section id="banner" class="banner">
            <div id="module_1" class="swiper-container">
                <div class="swiper-wrapper" id="bannerDiv">
                    <div class="two swiper-slide" id="bannerDemo" style="display:none"><img src="images/default_banner.jpg" data-name=" " /></div>
                </div>
                <div class="swiper-pagination"></div>    	
            </div>
        </section>
        <section class="program" id = "videoContent">
        </section>



        <!-- 视频展示模板-->
        <section class="program" id = "videoTemplate" style="display: none">
            <div class="title">
                <h2><em>/</em><span>幼儿英语</span><em>/</em></h2>
                <%--<a href="#">全部</a>--%>
            </div>
            <div class="ido_live">
                <li>
                    <div class="ct_logo"><img src="images/live.png" /> </div>
                    <div class="ct_info">
                        <h1></h1>
                        <h2></h2>
                        <h3><img src="images/live.gif"/><i class="tips"><img src="images/tips.png"></i> <span>98人次</span></h3>
                        <p><i><img src="images/encryption_blue.png"/></i></p>
                    </div>
                </li>
                <li>
                    <div class="ct_logo"><img src="images/live.png" /><div class="trailer_pop">今天<p>13:40</p></div></div>
                    <div class="ct_info">
                        <h1>校园英语培训班卡通风格</h1>
                        <h2>高级幼教－刘老师</h2>
                        <h3>98人报名</h3>
                        <p><i><img src="images/encryption_blue.png"/></i>免费</p>
                    </div>
                </li>
                <li>
                    <div class="ct_logo"><img src="images/live.png" /><div class="trailer_pop">今天<p>13:40</p></div></div>
                    <div class="ct_info">
                        <h1>校园英语培训班卡通风格</h1>
                        <h2>高级幼教－刘老师</h2>
                        <h3>98人报名</h3>
                        <p class="money">￥12</p>
                    </div>
                </li>
            </div>
        </section>
        <!-- 视频展示模板 end-->



        <footer class="index_footer">
            <p>银河直播由湖南科创信息提供技术支持</p>
            <p>售前支持：<a href="tel:13319571586">13319571586</a></p>
        </footer>
    </article>
	<footer>
        <ul class="menu_list">
            <li>
                <a href="liveIndex.jsp?n=<%=cooperateOrgId%>&v=1" class="now">
                    <dl class="index">
                        <dt></dt>
                        <dd>首页</dd>
                    </dl>
                </a>
            </li>
            <li>
                <a href="anchorinfoall.jsp?n=<%=cooperateOrgId%>&v=1">
                    <dl class="start">
                        <dt></dt>
                        <dd>主播</dd>
                    </dl>
                </a>
            </li>
            <li>
                <a href="me.jsp?n=<%=cooperateOrgId%>&v=1">
                    <dl class="me">
                        <dt></dt>
                        <dd>我的</dd>
                    </dl>
                </a>
            </li>
        </ul>
    </footer>
    <!-- script -->
    <script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="js/page.js"></script>
    <script  type="text/javascript" src="js/util.js"></script>
    <script  type="text/javascript" src="js/busi/livelist.js?2"></script>
	<script type="text/javascript" src="js/jweixin-1.0.0.js"></script>
    <script type="text/javascript" src="js/swiper.min.js"></script>
	<script type="text/javascript">
        var shareTitle ="银河直播间";
        var currentUrl =window.location.href;
        var shareImageUrl = "<%=basePath%>/live/images/logo.png";
        var cooperateOrgId = "<%=cooperateOrgId%>";        

        var i=1;// 第一页

        $(function() {
            var jsapiSignature;
            var userId;
            $.ajax({
                url:"../page/index",
                type:'get',
                dataType:'json',
                data:{"url":currentUrl},
                async: false,
                success : function(data) {
                    userId = data.userId;
                    jsapiSignature = data.jsapiSignature;
                }
            });

            //通过config接口注入权限验证配置
            wx.config({
                    debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
                    appId: jsapiSignature.appId,
                    timestamp: jsapiSignature.timestamp,
                    nonceStr: jsapiSignature.nonceStr,
                    signature: jsapiSignature.signature,
                    jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
                });

            wx.ready(function () {
                wx.onMenuShareAppMessage({
                    title: shareTitle,
                    link: jsapiSignature.url+"&shareUser="+userId,
                    imgUrl: shareImageUrl
                });

                wx.onMenuShareTimeline({
                    title: shareTitle,
                    link: jsapiSignature.url + "&shareUser="+userId,
                    imgUrl: shareImageUrl
                });

            });

            $("#liveTitle").bind('input propertychange',function(){
                  var txtChange = $("#liveTitle").val();
                  if(txtChange == ""){
                      $("#searchLi").html('');
                      $("#searchLi").hide();
                      $(".result").removeClass("active");
                  }else{
                      $("#searchLi").html('<i></i>搜索"<em>'+txtChange+'</em>"');
                      $("#searchLi").attr("onclick","searchLiveByTitle('"+txtChange+"')");
                      $("#searchLi").show();
                      $(".result").addClass("active");
                  }
            });

            loadBanner();//加载banner广告层
            loadVideoList();//加载视频列表

            $(window).bind("scroll", function(e){
                //已经滚动到上面的页面高度
                var scrollTop = $(this).scrollTop();
                 //页面高度
                var scrollHeight = $(document).height();
                  //浏览器窗口高度
                var windowHeight = $(this).height();
                 //此处是滚动条到底部时候触发的事件，在这里写要加载的数据，或者是拉动滚动条的操作
                if (scrollTop + windowHeight == scrollHeight) {
                    var nextPageNum = parseInt($("#nowPage").val())+1;
                    var totalPageNum = parseInt($("#totalPage").val());
                    if(nextPageNum<=totalPageNum){
                        loadInfoByPage(String(nextPageNum));
                    }
                }
            });

        });

        //加载翻页数据
        function loadVideoList() {
            var json = {};
            $.ajax({
                url:"../proxy/galaxy/v1/livevideo/classify_top",
                type:'get',
                dataType:'json',
                data:{"cooperateOrgId":cooperateOrgId},
                async: false,
                success : function(data) {
                    if(data == null){
                        $("#videoContent").append('<p style="text-align:center;margin-top:40px;font-size:0.75rem;color:#515151;">敬请期待相关主播为您上传的精彩内容...<p>');
                    }else{
                        fillIndexTopContent($("#videoTemplate"),$("#videoContent"),data);
                    }
                },error:function(){

                }
            });
        }
    </script>
    
</body>
</html>
